import request from "../../request";

// 获取树形菜单列表
export function getMenuListApi(params?: object) {
    return request({
        // url: 'http://localhost:5173/menu.json',
        url: 'menu',
        method: 'get',
        params
    });
}

/**
 * 新增
 * @param data
 */
export function addMenuApi(data: object){
    return request({
        url: 'menu',
        method: 'post',
        data: data
    })
}

// 根据ID获取信息
export function getMenuApi(id: number) {
    return request({
        url: `menu/detail/${id}`,
        method: 'get',
    })
}

/**
 * 编辑
 * @param data
 */
export function editMenuApi(data: object){
    return request({
        url: 'menu',
        method: 'put',
        data: data
    })
}

export function delMenuApi(id: number) {
    return request({
        url: `menu/${id}`,
        method: 'delete'
    })
}
